package com.zrj.config;

import com.zrj.handler.TokenHandlerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author zhaorujie
 * @version 1.0
 * @date 2021/6/26 9:23
 */
@Configuration
public class WxWebMvcConfig implements WebMvcConfigurer {

    @Bean
    public TokenHandlerInterceptor getTokenHandlerInterceptor() {
        return new TokenHandlerInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(getTokenHandlerInterceptor()).addPathPatterns("/api/**");
    }
}
